home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 551-575 / disk_559 / apig / apiglib_v11.lzh / e16_pointers.rexx < prev    next >
OS/2 REXX Batch file  |  1991-09-28  |  5KB  |  130 lines

  1. /* example using setpointer/clearpointer, getvalue/setvalue */
  2.  
  3. /*  */
  4.  x = addlib("apig.library",0,-30,0)
  5.  
  6. portname = "example16_port"
  7. p = openport(portname)
  8. call set_apig_globals()
  9. scrtitle = " This is Your New Screen  !"
  10. wintitle = " This is your Window Title"
  11. winidcmp = CLOSEWINDOW
  12. winflags = WINDOWCLOSE+WINDOWDRAG+WINDOWSIZING+WINDOWDEPTH+GIMMEZEROZERO+ACTIVATE
  13.  
  14. scr = openscreen(0,0,640,400,3,4,5,LACE+HIRES,CUSTOMSCREEN,scrtitle)
  15.  
  16. /* open window */
  17. w1  = openwindow(portname,0,0,640,400,2,4,winidcmp,winflags,wintitle,scr,0,0,0) 
  18.  
  19. rpw1 = getwindowrastport(w1)
  20.  
  21. call setrgb4(w1,0,6,6,6)
  22. call setrgb4(w1,1,2,5,15)
  23. call setrgb4(w1,2,4,12,9)
  24. call setrgb4(w1,3,9,4,9)
  25. call setrgb4(w1,7,15,15,15)
  26.   
  27. x = setrast(rpw1,7)
  28. pdata = allocmem(148,'0001 0002'x)
  29.  
  30. /* SPRITE DATA DEFINITION, this is NOT a 'SimpleSprite' structure */
  31.  
  32. /* Note: pdata[0] & pdata[1] are position control, please refer to RKM */
  33. /*       MEM_CLEAR made these zero                      */
  34.  
  35. /* first line of sprite image */
  36. x = setarray(pdata,2,c2d('0000'x))  ;  x = setarray(pdata,3,c2d('0000'x))
  37.  
  38. /* second line of sprite image */
  39. x = setarray(pdata,4,c2d('1f80'x))  ;  x = setarray(pdata,5,c2d('3f80'x))
  40.  
  41. /* third line of sprite image */
  42. x = setarray(pdata,6,c2d('0cc0'x))  ;  x = setarray(pdata,7,c2d('1cc0'x))
  43.  
  44. /* etc. ... */
  45. x = setarray(pdata,8,c2d('0cc0'x))  ;  x = setarray(pdata,9,c2d('1cc0'x))
  46. x = setarray(pdata,10,c2d('0f80'x)) ;  x = setarray(pdata,11,c2d('1f80'x))
  47. x = setarray(pdata,12,c2d('0cc0'x)) ;  x = setarray(pdata,13,c2d('1cc0'x))
  48. x = setarray(pdata,14,c2d('0cc0'x)) ;  x = setarray(pdata,15,c2d('1cc0'x))
  49. x = setarray(pdata,16,c2d('1f80'x)) ;  x = setarray(pdata,17,c2d('3f80'x))
  50. x = setarray(pdata,18,c2d('0000'x)) ;  x = setarray(pdata,19,c2d('0000'x))
  51. x = setarray(pdata,20,c2d('1980'x)) ;  x = setarray(pdata,21,c2d('3980'x))
  52. x = setarray(pdata,22,c2d('1980'x)) ;  x = setarray(pdata,23,c2d('3980'x))
  53. x = setarray(pdata,24,c2d('1980'x)) ;  x = setarray(pdata,25,c2d('3980'x))
  54. x = setarray(pdata,26,c2d('1980'x)) ;  x = setarray(pdata,27,c2d('3980'x))
  55. x = setarray(pdata,28,c2d('1980'x)) ;  x = setarray(pdata,29,c2d('3980'x))
  56. x = setarray(pdata,30,c2d('1980'x)) ;  x = setarray(pdata,31,c2d('3980'x))
  57. x = setarray(pdata,32,c2d('0f80'x)) ;  x = setarray(pdata,33,c2d('1f80'x))
  58. x = setarray(pdata,34,c2d('0000'x)) ;  x = setarray(pdata,35,c2d('0000'x))
  59. x = setarray(pdata,36,c2d('0f00'x)) ;  x = setarray(pdata,37,c2d('1f00'x))
  60. x = setarray(pdata,38,c2d('1980'x)) ;  x = setarray(pdata,39,c2d('3980'x))
  61. x = setarray(pdata,40,c2d('1c00'x)) ;  x = setarray(pdata,41,c2d('3c00'x))
  62. x = setarray(pdata,42,c2d('0e00'x)) ;  x = setarray(pdata,43,c2d('1e00'x))
  63. x = setarray(pdata,44,c2d('0380'x)) ;  x = setarray(pdata,45,c2d('0780'x))
  64. x = setarray(pdata,46,c2d('1980'x)) ;  x = setarray(pdata,47,c2d('3b80'x))
  65. x = setarray(pdata,48,c2d('0f00'x)) ;  x = setarray(pdata,49,c2d('1f00'x))
  66. x = setarray(pdata,50,c2d('0000'x)) ;  x = setarray(pdata,51,c2d('0000'x))
  67. x = setarray(pdata,52,c2d('30c0'x)) ;  x = setarray(pdata,53,c2d('70c0'x))
  68. x = setarray(pdata,54,c2d('30c0'x)) ;  x = setarray(pdata,55,c2d('70c0'x))
  69. x = setarray(pdata,56,c2d('1980'x)) ;  x = setarray(pdata,57,c2d('3980'x))
  70. x = setarray(pdata,58,c2d('0f00'x)) ;  x = setarray(pdata,59,c2d('1f00'x))
  71. x = setarray(pdata,60,c2d('0600'x)) ;  x = setarray(pdata,61,c2d('0e00'x))
  72. x = setarray(pdata,62,c2d('0600'x)) ;  x = setarray(pdata,63,c2d('0e00'x))
  73. x = setarray(pdata,64,c2d('0f00'x)) ;  x = setarray(pdata,65,c2d('1f00'x))
  74. x = setarray(pdata,66,c2d('0000'x)) ;  x = setarray(pdata,67,c2d('0000'x))
  75. x = setarray(pdata,68,c2d('0000'x)) ;  x = setarray(pdata,69,c2d('0000'x))
  76. /* height of this pointer is 34 */
  77.  
  78. /* Note: pdata[70] & pdata[71] are for attached sprites */
  79. /*       MEM_CLEAR made these zero                      */
  80.   
  81.   
  82.   x = setpointer(w1,pdata,34,16,0,0)
  83.  
  84.   z = pitext(rpw1,100,100," You Should have a BUSY pointer ",5,2,JAM2,0)
  85.   z = pitext(rpw1,100,140," You also have a new window title ",5,2,JAM2,0)
  86.   z = pitext(rpw1,300,370," DONE ",6,2,JAM2,0)
  87.  
  88.  
  89.   /** ---->>>  changing window title <<<---- **/
  90.   title = getvalue(w1,32,4,'S')
  91.   say "Your Window title is" title
  92.   
  93.   mynewtitle = ALLOCMEM(length("MY NEW TITLE")+1,'0001 0000'x)
  94.  
  95.   call EXPORT(mynewtitle,"MY NEW TITLE")
  96.  
  97.   x = setvalue(w1,32,4,'P',mynewtitle,0)
  98.   x = refreshwindowframe(w1)
  99.   say "set value=" x
  100.  
  101.   title = getvalue(w1,32,4,'S')
  102.   say "Your Window title is" title
  103.   
  104.   
  105.   
  106.   do forever   /* IDCMP loop, wait for CLOSEWINDOW message */
  107.      x = waitpkt(portname)
  108.      do forever 
  109.         msg = '0000 0000'x
  110.         msg = getpkt(portname)
  111.         if msg = '0000 0000'x then leave
  112.         class = getarg(msg,0)
  113.         if class = CLOSEWINDOW then exitme = 1
  114.         x = reply(msg,0)  
  115.      end  
  116.    if exitme = 1 then leave
  117.    
  118.   end
  119.   
  120. getout:  
  121.   
  122.   z = clearpointer(w1)
  123.   z = freemem(pdata,148)
  124.   z = freemem(mynewtitle,length("MY NEW TITLE")+1)
  125.   z = closewindow(w1)
  126.   z = closescreen(scr)
  127.   
  128.   exit
  129.  
  130.